<?php
	//
	// Calcule l'ecart en annes, mois et jours entre une date et la date courante
	// @param $firstDate:String => date au format jour/mois/annee
	// @returns Array ('jours' => Number, 'mois' => Number, 'annees' => Number)
	//
	function date_gap_fr($firstDate){
		//
		$secParAn = 60 * 60 * 24 * 365;
		$secParMois = 60 * 60 * 24 * 30;
		$secParJour = 60 * 60 * 24;
		//
		$secondDate = getdate();
		//
		$fd = explode('/', $firstDate);
		$fd_jour =  $fd[0];
		$fd_mois =  $fd[1];
		$fd_annee =  $fd[2];
		$fd_timestamp = mktime(0,0,0, $fd_mois, $fd_jour, $fd_annee);
		//
		$sd_jour = $secondDate['mday'];
		$sd_mois = $secondDate['mon'];
		$sd_annee = $secondDate['year'];
		$sd_timestamp = mktime(0,0,0, $sd_mois, $sd_jour, $sd_annee);
		//
		$timestamp_gap = $sd_timestamp - $fd_timestamp;
		$annees = $timestamp_gap / $secParAn;
		$reste = fmod($timestamp_gap, $secParAn);
		$mois = $reste / $secParMois;
		$reste = fmod($timestamp_gap, $secParMois);
		$jours = $reste / $secParJour;
		//
		$array['jours'] = floor($jours);
		$array['mois'] = floor($mois);
		$array['annees'] = floor($annees);
		return $array;
	}
	//
?>